[?php use_stylesheets_for_form($form) ?]
[?php use_javascripts_for_form($form) ?]

[?php if ($form->hasGlobalErrors()): ?]
[?php echo $form->renderGlobalErrors() ?]
[?php endif; ?]

<form  class="ui-form" action="[?php echo url_for('<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter')) ?]" method="post">

    [?php echo $form->renderHiddenFields() ?]

    <fieldset class="ui-widget ui-fieldset">
        <div class="ui-widget-header ui-filter-legend ui-corner-large-top">
            <p class="ui-icon-16 ui-icon-search"></p>
            <h3 class="ui-widget-title">
                [?php echo __('Filter') ?]
            </h3>
        </div>
    
        <div class="ui-widget-content ui-fieldset-content">
            [?php foreach ($configuration->getFormFilterFields($form) as $name => $field): ?]
            [?php if ((isset($form[$name]) && $form[$name]->isHidden()) || (!isset($form[$name]) && $field->isReal())) continue ?]
            <div class="ui-form-field">
                [?php include_partial('<?php echo $this->getModuleName() ?>/filters_field', array(
                    'name'       => $name,
                    'attributes' => $field->getConfig('attributes', array()),
                    'label'      => $field->getConfig('label'),
                    'help'       => $field->getConfig('help'),
                    'form'       => $form,
                    'field'      => $field,
                    'class'      => 'ui-form-field ui-'.strtolower($field->getType()).' sf_admin_filter_field_'.$name,
                  )) ?]
            </div>
            [?php endforeach; ?]
        </div>

        <div class="ui-widget-header ui-filter-footer ui-corner-large-bottom">
            [?php echo link_to(__('Reset', array(), 'sf_admin'), '<?php echo $this->getUrlForAction('collection') ?>', array('action' => 'filter'), array('query_string' => '_reset', 'method' => 'post', 'class' => 'ui-button-reset ui-button')) ?]
            <input class="ui-button-filter" type="submit" value="[?php echo __('Filter', array(), 'sf_admin') ?]" />        
        </div> 
        
        </fieldset>

</form>
